<template>
  <div class="articleQuery">
    <div style="padding: 30px;">
    </div>
    <div class="app-container">
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <el-row :gutter="20">
            <el-col :span="4"><span style="display: inline-block;vertical-align: middle;line-height: 40px;">流程图列表</span></el-col>
            <el-col :span="6" :offset="10">
              <div style="display: inline-block;vertical-align: middle;line-height: 40px;">
                <div style="display: inline-block;vertical-align: middle;">
                  <el-input size="small" v-model="tableSearchCon" @blur="inputBlur" placeholder="请输入搜索标题" style="display: inline-block;width: 70%;"></el-input>
                  <el-button size="small" type="primary" @click="tableContentSearch">搜索</el-button>
                </div>
              </div>
            </el-col>
            <el-col :span="4">
              <div style="display: inline-block;vertical-align: middle;line-height: 40px;">
                <el-button type="primary" size="small" @click="addPageInfo">新增</el-button>
                <!--<el-button type="danger" size="small" @click="removeTable">删除</el-button>-->
              </div>
            </el-col>
          </el-row>
        </div>
        <div class="logonRelease_content notSize">
          <el-table
            :data="tableData"
            @select="tableCheck"
            stripe
            height="340"
            style="width: 100%">
            <el-table-column
              prop="title"
              width="200"
              align="center"
              label="信息标题">
            </el-table-column>
            <el-table-column
              prop="notice"
              width="100"
              align="center"
              label="栏目">
              <template slot-scope="scope">
                <span>{{scope.row.type | typeNum}}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="addTime"
              align="center"
              label="发布时间">
            </el-table-column>
            <el-table-column
              prop="editTime"
              align="center"
              label="创建时间">
            </el-table-column>
            <el-table-column
              align="center"
              label="状态">
              <template slot-scope="scope">
                <span>{{scope.row.status | stateCount}}</span>
              </template>
            </el-table-column>
            <el-table-column
              align="center"
              width="160"
              label="操作">
              <template slot-scope="scope">
                <div class="articleBtnBox">
                  <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                    <el-button type="primary" size="mini" icon="el-icon-edit" circle @click="editBtn(scope.row.id)"></el-button>
                  </el-tooltip>
                  <el-tooltip class="item" effect="dark" content="删除" placement="top">
                    <el-button type="danger" size="mini" icon="el-icon-delete" circle @click="removeBtn(scope.row.id)"></el-button>
                  </el-tooltip>
                  <el-tooltip class="item" effect="dark" content="查看" placement="top">
                    <el-button type="info" size="mini" icon="el-icon-view" circle @click="viewBtn(scope.row.id)"></el-button>
                  </el-tooltip>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div style="padding: 0px 0px 0px 0px;margin: 0px 0px 0px 0px;">
          <paging :size-change="handleSizeChange"
                  :current-change="handleCurrentChange"
                  :page-sizes="pageSizes"
                  :page-num="pageNum"
                  :total-num="totalNum">
          </paging>
        </div>
      </el-card>
    </div>
  </div>
</template>

<script>
  import paging from '@/components/demoAssembly/paging' // 分页
  export default {
    data() {
      return {
        timeValue: '',
        pageSizes: [10],
        pageNum: 10,
        totalNum: null,
        myDataId: [],
        checkData: [],
        tableSearchCon: '',
        serialNumber: 1,
        pageSize: {},
        valBegin: '',
        valEnd: '',
        postList: {},
        tableData: []
      }
    },
    components: {
      paging
    },
    filters: {
      typeNum: function(value) {
        if (value === '0') {
          return '公司新闻'
        } else {
          return '通知公告'
        }
      }
    },
    /**
     * 组件创建完成后，查询列表数据
     */
    created() {

    },
    mounted() {
      // this.fetchData()
    },
    methods: {
      fetchData() { // 获取内容
        this.$store
          .dispatch('NewsList', this.postList)
          .then(res => {
            this.tableData = res.data.records
            this.totalNum = res.data.count
          })
          .catch(() => {

          })
      },
      addPageInfo() {
        console.log('新增流程图')
        this.$router.push({ name: 'antvG6Index', query: { isNew: 'newAntv' }})
      }
    }
  }
</script>

<style>

</style>
<style scoped>
  .articleBtnBox >>> .el-button.is-circle{
    padding: 8px !important;
  }
</style>
